import request from '@/utils/request.js'

/*订单api*/




//查询订单列表
export function getOderList(data) {
	return request({
		url: '/order/order/orderList',
		method: 'POST',
		data
	})
}


//创建一级市场订单
export function createOrder(data) {
	return request({
		url: '/order/pay/CreateOrder',
		method: 'POST',
		data
	})
}


//创建二级市场订单
export function createMarketOrder(data) {
	return request({
		url: '/order/pay/CreateMarketOrder',
		method: 'POST',
		data
	})
}


/**
 * 订单详情
 */
export function getOrderDetails(id,order_type=1) {
	let url=`/order/order/orderDetail/ids/${id}`
	if (order_type == '2') {
		url = `/order/order/MarketOrderDetail/ids/${id}`
	}
	return request({
		url,
		method: 'POST',
	})
}


/**
 * 修改订单状态
 **/
export function changeOrderStatus(data) {
	//订单类型 1普通市场 2二级市场
	const {
		order_type
	} = data;
	let url = '/order/order/changeOrderStatus'
	if (order_type == '2') {
		url = '/order/order/changeMarketOrderStatus'
	}
	return request({
		url,
		method: 'post',
		data
	})
}


/**
 *支付 
 * @param {Object} data 
 */
export function doPay(data){
	return request({
		url:'/order/pay/doPay',
		method:"POST",
		data
	})
}


/**
 * 抽签报名
 * @param {*} data 
 */
export function signUpDraw(data){
	return request({
		url:'/drawbuy/doQualification',
		method:"POST",
		data
	})
}


/**
 * 查询抽签状态
 * @param {*} data 
 */
export function queryDrawStatus(data){
	return request({
		url:'/order/pay/lookQualification',
		method:"POST",
		data
	})
}

/**
 * 查询报名抽签列表
 * @param {*} data 
 */
export function queryDramOrSignUpList(data){
	return request({
		url:'/order/pay/qualification',
		method:"POST",
		data
	})
}

//开通钱包A
export function openHfWallet(data){
	return request({
		url:'/wallet/huifu/openAccount',
		method:"POST",
		data
	})
}
export function getWalletAddr(data){
	return request({
		url:'/wallet/huifu/wallet',
		method:"POST",
		data
	})
}


// 创建开户收取手续费订单
export function CreateHuifuAccountOrder(data){
	return request({
		url:'/order/pay/CreateHuifuAccountOrder',
		method:"POST",
		data
	})
}